package com.jplayground.tree;

/**
 * @author Natalia Batishcheva
 * @project Calabria
 * @data: 05.01.2008
 */
public class TreeBuilder {
    public TreeNodeVO build() {
        TreeNodeVO root = new TreeNodeVO(1, "Root");

        for (int i = 0; i < 3; i++) {
            TreeNodeVO node = new TreeNodeVO(100 + 100 * i, "Folder " + i);
            node.setParent(root);

            for (int j = 0; j < 2; j++) {
                TreeNodeVO node1 = new TreeNodeVO(1000 + 1000 * (i + j), "Folder " + i + j);

                for (int k = 0; k < 4; k++) {
                    final TreeNodeVO node2 = new TreeNodeVO(10000 + 10000 * (i + j + k), "Leaf Leaf Leaf Leaf Leaf Leaf Leaf Leaf Leaf Leaf Leaf Leaf Leaf Leaf Leaf " + i + j + k);
                    node2.setParent(node1);
                    node2.setLeaf(true);

                    node1.addSubNode(node2);
                }

                node1.setParent(node);
                node.addSubNode(node1);
            }

            root.addSubNode(node);
        }

        return root;
    }
}
